
$(function () {
    $("#submit-btn").click(function (event) {
        event.preventDefault();
        var telephone_input = $("input[name='telephone']");
        var password_input = $("input[name='password']");
        var remember_input = $("input[name='remember']");

        var telephone = telephone_input.val();
        var password = password_input.val();
        // 三公运算符 ？前成立返回1 不成立返回0
        var remember = remember_input.is(':checked') ? 1 : 0;

        zlajax.post({
            "url":"/front/signin/",
            "data":{
                "telephone":telephone,
                "password":password,
                "remember":remember
            },
            "success": function (data) {
                if(data["code"]==200){
                    // xtalert.alertSuccessToast("登陆成功")
                    var  return_to = $("#return-to-span").text()
                    if (return_to){
                        window.location = return_to
                    }else {
                        window.location = "/front/"
                    }
                }else {
                    xtalert.alertInfoToast(data["message"])
                }
            }
        })

    })
})